import axios from '../axios'
import { ArticleType } from './type'

export const getArticleAll = () => axios.request<ArticleType[]>({ url: 'admin/article/findall' })

export const getArticleById = (id: string) => axios.request<ArticelModel>({ url: `articel/${id}` })

export const findByTitle = (title: string) => axios.request<ArticleType[]>({ url: `articel/bytitle/${title}` })

export const deleteById = (id: number) => axios.request({ url: `articel/${id}`, method: 'delete' })

export const updateStatus = (id: number, status: number) =>
   axios.request({ url: `admin/article/${id}/${status}`, method: 'patch' })
